<ul class="navbar-nav">
    <li class="nav-item">
      <a class="nav-link" onclick="window.history.back()""><i class="iconcis icon-goback f30"></i></a>
    </li>
    <li class="nav-item border-right">
      <a class="nav-link" href="__ROOT__/"><i class="iconcis icon-home f20"></i></a>
    </li>
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">
        <i class="iconcis icon-search"></i>
      </a>
      <div class="dropdown-menu search-menu">
        <form class="form-inline">
          <input class="form-control" type="search" placeholder="搜索" aria-label="搜索">
          <button class="btn" type="submit"><i class="iconcis icon-search"></i></button>
        </form>
      </div>
    </li>
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">
        <i class="iconcis icon-user"></i>
      </a>
      <div class="dropdown-menu login-menu">
        <?php $user=cmf_get_current_user();?>
        <if condition="empty($user)">
          <form class="index-login">
            <div class="wrapper">
              <h4 class="bg-line-red">登录</h4>
              <div style="text-align:center;">
                <a class="error" style="color:red;height:15px;line-height: 0px;"></a>
              </div>
              <div class="login-group">
                <i class="iconcis icon-user"></i>
                <input type="text" id="input_username" name="username" placeholder="请输入用户名/电子信箱">
              </div>
              <div class="login-group">
                <i class="iconcis icon-user"></i>
                <input type="password" id="input_password" name="password" placeholder="请输入密码">
              </div>
              <button class="btn" type="button" onclick="user_login()">立即登录</button>
              <p class="link"><a href="{:cmf_url('user/Register/index')}">免费注册</a>|<a href="{:cmf_url('user/Login/findPassword')}">忘记密码</a></p>
              <h5>快捷登录</h5>
              <p>用第三方账号快速登录</p>
              <div class="row text-center">
                <div class="col-sm-6">
                  <img src="__TMPL__/public/assets/images/login_qq.png">
                  <p>QQ登录</p>
                </div>
                <div class="col-sm-6">
                  <img src="__TMPL__/public/assets/images/login_wx.png">
                  <p>微信登录</p>
                </div>
              </div>
            </div>
            <div class="login-footer">
              注册或登录即表示同意<br>
              本系统的”隐私保护条款”和”使用条款”。
            </div>	
          </form>
          <else />
            <a class="dropdown-toggle user" data-toggle="dropdown" href="#">
            <if condition="empty($user['avatar'])">
                <img src="__TMPL__/public/assets/images/headicon.png" class="headicon">
                <else/>
                <img src="{:cmf_get_user_avatar_url($user['avatar'])}" class="headicon" width="30"/>
            </if>
            <span class="user-nickname"></span>
              <b class="caret">{$user['user_login']}</b>
            </span>
            <ul class="pull-right">
                <li><a href="{:cmf_url('user/Profile/center')}"><i class="fa fa-user"></i> &nbsp;个人中心</a></li>
                <li class="divider"></li>
                <li><a href="{:cmf_url('user/Index/logout')}"><i class="fa fa-sign-out"></i> &nbsp;退出</a></li>
            </ul>
          </if>
      </div>
    </li>
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">
        <i class="iconcis icon-map"></i>
      </a>
      <div class="dropdown-menu">
        <a class="dropdown-item" href="#"><i class="flag flag-china"></i>简体中文版</a>
        <a class="dropdown-item" href="#"><i class="flag flag-english"></i>English</a>
        <a class="dropdown-item" href="#"><i class="flag flag-sprache"></i>Sprache</a>
        <a class="dropdown-item" href="#"><i class="flag flag-japan"></i>日本語</a>
      </div>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="#"><i class="iconcis icon-lines"></i></a>
    </li>
</ul>
<script>
function user_login(){
  var url = '';
  var username = $('input[name="username"]').val();
  var password = $('input[name="password"]').val();
  $.post('/user/login/doLogin',{username:username,password:password},function(data){
      if(msg != ''){
        var msg = data.msg;
        $('.error').text(msg);
        window.location.reload();
      }
  })
}
</script>
